package com.tommy.ddp.box
{
	import com.tommy.ddp.GridDataManager;
	import com.tommy.ddp.definition.DDPConfig;

	/**
	 * 棋子的创建工厂
	 * @author hongxuan
	 * 
	 */	
	public class BoxFactory
	{
		public function BoxFactory()
		{
		}
		
		public static function createSpecifiedBox(xIndex:int,yIndex:int,colorType:uint,exeType:uint):DdpBox
		{
			var box:DdpBox = new DdpBox();
			box.setType(colorType,exeType);
			box.column = xIndex;
			box.row = yIndex;
			GridDataManager.regBox(xIndex,yIndex,box);
			return box;
		}
		
		public static function createRandomBox(xIndex:int,yIndex:int):DdpBox
		{
			var box:DdpBox = new DdpBox();
			var color:uint = Math.floor(Math.random()*DDPConfig.COLOR_NUM);
			box.setType(color);
			box.column = xIndex;
			box.row = yIndex;
			GridDataManager.regBox(xIndex,yIndex,box);
			return box;
		}
	}
}